﻿using Bouyei.GeoCore.GeoParsers.GeoJson;
using System;
using System.Collections.Generic;

namespace Bouyei.GeoCore.GeoParsers.Parser
{

    public class GeoJsonParser
    {
        public GeoJsonParser( )
        {
            
        }

        public Feature<Property, Geom> ReaderFeature<Property, Geom>(string jsonString)
        {
            GeometryReader reader = new GeometryReader(jsonString);
            return reader.FromReaderToFeature<Property, Geom>();
        }

        public FeatureCollection<Property, Geom> ReaderFeatureCollection<Property, Geom>(string jsonString)
        {
            GeometryReader reader = new GeometryReader(jsonString);
            return reader.FromReaderToFeatureCollection<Property, Geom>();
        }

        public GeometryCollection<Geom> ReaderGeometryCollection<Geom>(string jsonString)
        {
            GeometryReader reader = new GeometryReader(jsonString);
            return reader.FromReaderToGeometryCollection<Geom>();
        }
        public string ToWriter<Property, Geom>(FeatureCollection<Property, Geom> collection)
        {
            GeometryWriter writer = new GeometryWriter();
            return writer.ToWriter<Property, Geom>(collection);
        }
        public void ToWriter<Geom>(GeometryCollection<Geom> collection)
        {
            GeometryWriter writer = new GeometryWriter();
            writer.ToWriter<Geom>(collection);
        }
    }
}
